<?php if (!defined('THINK_PATH')) exit(); /*a:2:{s:64:"E:\phpCloud\ruanlink\public/../app/spadmin\view\domain\edit.html";i:1732974074;s:54:"E:\phpCloud\ruanlink\app\spadmin\view\public\base.html";i:1732971886;}*/ ?>
<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"/>
		<title>后台管理系统</title>
		<!-- 样 式 文 件 -->
		<link rel="stylesheet" href="/assets/library/core/css/core.css?v=<?php echo config('version'); ?>" />
        
	</head>
    <!-- 代 码 结 构 -->
	
<body class="pear-container">
	<form class="layui-form layui-form-pane" action="">
        <div class="mainBox">
            <div class="main-container">
                <div class="layui-form-item">
                    <label class="layui-form-label">域名</label>
                    <div class="layui-input-block">
                        <input type="text" name="host" value="<?php echo (isset($info['host']) && ($info['host'] !== '')?$info['host']:''); ?>" lay-verify="require" autocomplete="off"
                            placeholder="请输入域名" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">绑定方式</label>
                    <div class="layui-input-block">
                        <select name="domain_type">
                            <option value="">请选择</option>
                            <option value="1" <?php if(isset($info['domain_type'])): if($info['domain_type'] == '1'): ?> selected <?php endif; endif; ?>>转链接</option>
                            <option value="2" <?php if(isset($info['domain_type'])): if($info['domain_type'] == '2'): ?> selected <?php endif; endif; ?>>落地页</option>
                        </select>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">绑定用户</label>
                    <div class="layui-input-block">
                        <select name="user_id"  lay-search="">
                            <option value="">选择用户</option>
                            <?php if(is_array($userlist) || $userlist instanceof \think\Collection || $userlist instanceof \think\Paginator): $i = 0; $__LIST__ = $userlist;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?>
                            <option value="<?php echo $vo['id']; ?>" <?php if(isset($info['user_id'])): if($vo['id'] == $info['user_id']): ?> selected <?php endif; endif; ?>><?php echo $vo['username']; ?></option>
                            <?php endforeach; endif; else: echo "" ;endif; ?>
                        </select>
                    </div>
                </div>
            </div>
        </div>
            <div class="bottom">
                <div class="button-container">
                    <input type="hidden" name="id" value="<?php echo (isset($info['id']) && ($info['id'] !== '')?$info['id']:''); ?>">
                    <button type="submit" class="pear-btn pear-btn-primary pear-btn-sm" lay-submit="" lay-filter="form-save">
                        <i class="layui-icon layui-icon-ok"></i> 提交
                    </button>
                    <button type="reset" class="pear-btn pear-btn-sm">
                        <i class="layui-icon layui-icon-refresh"></i>
                        重置
                    </button>
                </div>
            </div>
            
    </form>
</body>

    <!-- 资 源 引 入 -->
		<script src="/assets/library/layui/layui.js?v=12<?php echo config('version'); ?>"></script>
		<script src="/assets/library/core/core.js?v=12<?php echo config('version'); ?>"></script>
		<script src="/static/js/qiniu.min.js?v=12<?php echo config('version'); ?>"></script>
	
	<script type="text/html" id="table-toolbar">
		<button class="pear-btn pear-btn-primary pear-btn-md" lay-event="add">
			<i class="layui-icon layui-icon-add-1"></i>
			新增
		</button>
		<button class="pear-btn pear-btn-danger pear-btn-md" lay-event="batchRemove">
			<i class="layui-icon layui-icon-delete"></i>
			删除
		</button>
	</script>
	<script type="text/html" id="table-bar">
		<button class="pear-btn pear-btn-primary pear-btn-sm" lay-event="edit"><i class="layui-icon layui-icon-edit"></i></button>
		<button class="pear-btn pear-btn-danger pear-btn-sm" lay-event="remove"><i class="layui-icon layui-icon-delete"></i></button>
	</script>
	
    
<script>
    layui.use(['form','jquery','element','select'], function() {
        let form = layui.form;
        let $ = layui.jquery;
        let select = layui.select;
        form.on('submit(form-save)', function(data) {
            $.ajax({
                url: '<?php echo url("edit"); ?>',
                data: JSON.stringify(data.field),
                dataType: 'json',
                contentType: 'application/json',
                type: 'post',
                success: function(result) {
                    if (result.code == '1') {
                        layer.msg(result.msg, {
                            icon: 1,
                            time: 1000
                        }, function() {
                            parent.layer.close(parent.layer.getFrameIndex(window
                                .name)); //关闭当前页
                            parent.layui.table.reload("table-list");
                        });
                    } else {
                        layer.msg(result.msg, {
                            icon: 2,
                            time: 1000
                        });
                    }
                }
            })
            return false;
        });
    })
</script>

</html>
